
package aa.tool;

import aa.core.Contract;
import java.io.Serializable;

import aa.core.CyberOrg;
import aa.util.ObjectHandler;

/**
 *  This class describes an actor tuple.
 *  An actor tuple consists of the name of an actor and its attributes. 
 * 
 *  <p>
 *  <b>History:</b>
 *  <ul>
 * 	<li> February 19, 2004 - version 0.0.3
 * 	<ul>
 * 	    <li> do minor modification.
 * 	</ul>
 *      <li> January 27, 2004 - version 0.0.2
 *      <ul>
 *          <li> modify internal comments.
 *      </ul>
 *      <li> June 3, 2003 - version 0.0.1
 *      <ul>
 *          <li> create this file.
 *      </ul>
 *  </ul>
 * 
 *  @author mehadihasan
 *  @version $Date: 2011/04/23 00:23:57 $ $Revision: 1.1 $
 */
 
public class CyberOrgTuple implements Serializable
{
    // ========== Object Variables ========== //
    
    /**
     *  The name of an actor. 
     */
    private CyberOrg m_anCyberOrg;
    String destination="", facClassName="";
    int id=0;
    Contract contract=null;
    String gameName="";

    public String getGameName() {
        return gameName;
    }

    public void setGameName(String gameName) {
        this.gameName = gameName;
    }

    public Contract getContract() {
        return contract;
    }

    public void setContract(Contract contract) {
        this.contract = contract;
    }

    public String getDestination() {
        return destination;
    }

    public void setDestination(String destination) {
        this.destination = destination;
    }

    public String getFacClassName() {
        return facClassName;
    }

    public void setFacClassName(String facClassName) {
        this.facClassName = facClassName;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    /**
     *  An array of elements to represent information for the actor.
     */
    private Object[] m_objaElements;
    

    // ========== Object Methods ========== //

    /**
     *  Creates an actor tuple.
     * 
     *  @param p_anCyberOrg the name of an actor.
     *  @param p_serEle1 the first element to represent information for the actor.
     */
    public CyberOrgTuple(CyberOrg p_anCyberOrg, Serializable p_serEle1)
    {
    	Object[] objaElements = { p_serEle1 };
    	
    	m_anCyberOrg = p_anCyberOrg;
    	m_objaElements = objaElements;
    }


    /**
     *  Creates an actor tuple.
     *
     *  @param p_anCyberOrg the name of an actor.
     *  @param p_serEle1 the first element to represent information for the actor.
     *  @param p_serEle2 the second element to represent information for the actor.
     */
    public CyberOrgTuple(String destination, int id, String facClassName)
    {
    	this.destination=destination;
        this.id=id;
        this.facClassName=facClassName;
    }

    /**
     *  Creates an actor tuple.
     *
     *  @param p_anCyberOrg the name of an actor.
     *  @param p_serEle1 the first element to represent information for the actor.
     *  @param p_serEle2 the second element to represent information for the actor.
     */
    public CyberOrgTuple(String destination, int id, String facClassName, Contract contract)
    {
    	this.destination=destination;
        this.id=id;
        this.facClassName=facClassName;
        this.contract = contract;
    }
    /**
     *  Creates an actor tuple.
     * 
     *  @param p_anCyberOrg the name of an actor.
     *  @param p_serEle1 the first element to represent information for the actor.
     *  @param p_serEle2 the second element to represent information for the actor.
     */
    public CyberOrgTuple(CyberOrg p_anCyberOrg, Serializable p_serEle1, Serializable p_serEle2)
    {
    	Object[] objaElements = { p_serEle1, p_serEle2 };
    	
    	m_anCyberOrg = p_anCyberOrg;
    	m_objaElements = objaElements;
    }
    
    /**
     *  Creates an actor tuple.
     * 
     *  @param p_anCyberOrg the name of an actor.
     *  @param p_serEle1 the first element to represent information for the actor.
     *  @param p_serEle2 the second element to represent information for the actor.
     *  @param p_serEle3 the third element to represent information for the actor.
     */
    public CyberOrgTuple(CyberOrg p_anCyberOrg, Serializable p_serEle1, Serializable p_serEle2,
    		      Serializable p_serEle3)
    {
    	Object[] objaElements = { p_serEle1, p_serEle2, p_serEle3 };
    	
    	m_anCyberOrg = p_anCyberOrg;
    	m_objaElements = objaElements;
    }
    
    /**
     *  Creates an actor tuple.
     * 
     *  @param p_anCyberOrg the name of an actor.
     *  @param p_serEle1 the first element to represent information for the actor.
     *  @param p_serEle2 the second element to represent information for the actor.
     *  @param p_serEle3 the third element to represent information for the actor.
     *  @param p_serEle4 the fourth element to represent information for the actor.
     */
    public CyberOrgTuple(CyberOrg p_anCyberOrg, Serializable p_serEle1, Serializable p_serEle2,
    		      Serializable p_serEle3, Serializable p_serEle4)
    {
    	Object[] objaElements = { p_serEle1, p_serEle2, p_serEle3, p_serEle4 };
    	
    	m_anCyberOrg = p_anCyberOrg;
    	m_objaElements = objaElements;
    }
    
    /**
     *  Creates an actor tuple.
     * 
     *  @param p_anCyberOrg the name of an actor.
     *  @param p_serEle1 the first element to represent information for the actor.
     *  @param p_serEle2 the second element to represent information for the actor.
     *  @param p_serEle3 the third element to represent information for the actor.
     *  @param p_serEle4 the fourth element to represent information for the actor.
     *  @param p_serEle5 the fifth element to represent information for the actor.
     */
    public CyberOrgTuple(CyberOrg p_anCyberOrg, Serializable p_serEle1, Serializable p_serEle2,
    		      Serializable p_serEle3, Serializable p_serEle4, Serializable p_serEle5)
    {
    	Object[] objaElements = { p_serEle1, p_serEle2, p_serEle3, p_serEle4, p_serEle5 };
    	
    	m_anCyberOrg = p_anCyberOrg;
    	m_objaElements = objaElements;
    }
    
    /**
     *  Creates an actor tuple.
     * 
     *  @param p_anCyberOrg the name of an actor.
     *  @param p_serEle1 the first element to represent information for the actor.
     *  @param p_serEle2 the second element to represent information for the actor.
     *  @param p_serEle3 the third element to represent information for the actor.
     *  @param p_serEle4 the fourth element to represent information for the actor.
     *  @param p_serEle5 the fifth element to represent information for the actor.
     *  @param p_serEle6 the sixth element to represent information for the actor.
     */
    public CyberOrgTuple(CyberOrg p_anCyberOrg, Serializable p_serEle1, Serializable p_serEle2,
    		      Serializable p_serEle3, Serializable p_serEle4, Serializable p_serEle5,
    		      Serializable p_serEle6)
    {
    	Object[] objaElements = { p_serEle1, p_serEle2, p_serEle3, p_serEle4, p_serEle5,
    				  p_serEle6 };
    	
    	m_anCyberOrg = p_anCyberOrg;
    	m_objaElements = objaElements;
    }
        
    /**
     *  Creates an actor tuple.
     * 
     *  @param p_anCyberOrg the name of an actor.
     *  @param p_serEle1 the first element to represent information for the actor.
     *  @param p_serEle2 the second element to represent information for the actor.
     *  @param p_serEle3 the third element to represent information for the actor.
     *  @param p_serEle4 the fourth element to represent information for the actor.
     *  @param p_serEle5 the fifth element to represent information for the actor.
     *  @param p_serEle6 the sixth element to represent information for the actor.
     *  @param p_serEle7 the seventh element to represent information for the actor.
     */
    public CyberOrgTuple(CyberOrg p_anCyberOrg, Serializable p_serEle1, Serializable p_serEle2,
    		      Serializable p_serEle3, Serializable p_serEle4, Serializable p_serEle5,
    		      Serializable p_serEle6, Serializable p_serEle7)
    {
    	Object[] objaElements = { p_serEle1, p_serEle2, p_serEle3, p_serEle4, p_serEle5,
    				  p_serEle6, p_serEle7 };
    	
    	m_anCyberOrg = p_anCyberOrg;
    	m_objaElements = objaElements;
    }
        
    /**
     *  Creates an actor tuple.
     * 
     *  @param p_anCyberOrg the name of an actor.
     *  @param p_serEle1 the first element to represent information for the actor.
     *  @param p_serEle2 the second element to represent information for the actor.
     *  @param p_serEle3 the third element to represent information for the actor.
     *  @param p_serEle4 the fourth element to represent information for the actor.
     *  @param p_serEle5 the fifth element to represent information for the actor.
     *  @param p_serEle6 the sixth element to represent information for the actor.
     *  @param p_serEle7 the seventh element to represent information for the actor.
     *  @param p_serEle8 the eighth element to represent information for the actor.
     */
    public CyberOrgTuple(CyberOrg p_anCyberOrg, Serializable p_serEle1, Serializable p_serEle2,
    		      Serializable p_serEle3, Serializable p_serEle4, Serializable p_serEle5,
    		      Serializable p_serEle6, Serializable p_serEle7, Serializable p_serEle8)
    {
    	Object[] objaElements = { p_serEle1, p_serEle2, p_serEle3, p_serEle4, p_serEle5,
    				  p_serEle6, p_serEle7, p_serEle8 };
    	
    	m_anCyberOrg = p_anCyberOrg;
    	m_objaElements = objaElements;
    }
        
    /**
     *  Creates an actor tuple.
     * 
     *  @param p_anCyberOrg the name of an actor.
     *  @param p_serEle1 the first element to represent information for the actor.
     *  @param p_serEle2 the second element to represent information for the actor.
     *  @param p_serEle3 the third element to represent information for the actor.
     *  @param p_serEle4 the fourth element to represent information for the actor.
     *  @param p_serEle5 the fifth element to represent information for the actor.
     *  @param p_serEle6 the sixth element to represent information for the actor.
     *  @param p_serEle7 the seventh element to represent information for the actor.
     *  @param p_serEle8 the eighth element to represent information for the actor.
     *  @param p_serEle9 the ninth element to represent information for the actor.
     */
    public CyberOrgTuple(CyberOrg p_anCyberOrg, Serializable p_serEle1, Serializable p_serEle2,
    		      Serializable p_serEle3, Serializable p_serEle4, Serializable p_serEle5,
    		      Serializable p_serEle6, Serializable p_serEle7, Serializable p_serEle8,
    		      Serializable p_serEle9)
    {
    	Object[] objaElements = { p_serEle1, p_serEle2, p_serEle3, p_serEle4, p_serEle5,
    				  p_serEle6, p_serEle7, p_serEle8, p_serEle9 };
    	
    	m_anCyberOrg = p_anCyberOrg;
    	m_objaElements = objaElements;
    }
        
    /**
     *  Creates an actor tuple.
     * 
     *  @param p_anCyberOrg the name of an actor.
     *  @param p_serEle1 the first element to represent information for the actor.
     *  @param p_serEle2 the second element to represent information for the actor.
     *  @param p_serEle3 the third element to represent information for the actor.
     *  @param p_serEle4 the fourth element to represent information for the actor.
     *  @param p_serEle5 the fifth element to represent information for the actor.
     *  @param p_serEle6 the sixth element to represent information for the actor.
     *  @param p_serEle7 the seventh element to represent information for the actor.
     *  @param p_serEle8 the eighth element to represent information for the actor.
     *  @param p_serEle10 the tenth element to represent information for the actor.
     */
    public CyberOrgTuple(CyberOrg p_anCyberOrg, Serializable p_serEle1, Serializable p_serEle2,
    		      Serializable p_serEle3, Serializable p_serEle4, Serializable p_serEle5,
    		      Serializable p_serEle6, Serializable p_serEle7, Serializable p_serEle8,
    		      Serializable p_serEle9, Serializable p_serEle10)
    {
    	Object[] objaElements = { p_serEle1, p_serEle2, p_serEle3, p_serEle4, p_serEle5,
    				  p_serEle6, p_serEle7, p_serEle8, p_serEle9, p_serEle10 };
    	
    	m_anCyberOrg = p_anCyberOrg;
    	m_objaElements = objaElements;
    }
        

    /**
     *  Returns the actor name registered.
     * 
     *  @return the actor name registered.
     */
    public final CyberOrg getCyberOrg()
    {
	return m_anCyberOrg;
    }


    /**
     *  Rerturns elements in this actor tuple as an array of objects.
     * 
     *  @return elements in this actor tuple as an array of objects.
     */
    public final Object[] getElements()
    {
        return m_objaElements;
    }


    /**
     *  Returns the element at the specified index of this actor tuple.
     * 
     *  @param p_iIdx the index of the element.
     * 
     *  @return the element at the specified index of this actor tuple 
     *               if the object exists; <br>
     *           <code>null</code> otherwise.
     */
    public final Object getElement(int p_iIdx)
    {
    	if (p_iIdx < m_objaElements.length) {
	    return m_objaElements[p_iIdx];
    	} else {
    	    return null;
    	}
    }


    /**
     *  Returns the number of elements in this actor tuple.
     * 
     *  @return the the number of elements in this actor tuple.
     */
    public int sizeOfElements()
    {
        return m_objaElements.length;
    }


    /**
     *  Converts this actor tuple into a string representation. 
     * 
     *  @return a string representation of the given object array.
     */
    @Override
    public String toString()
    {
    	return "[ Destination: " + getDestination() + ", id: "+ getId() +", Facilitator class: "+getFacClassName()+", Contract: "+getContract()+ " ]";
    }
}
